/*
 * @Author: jiutian
 * @Date: 2023-01-31 10:29:19
 * @LastEditTime: 2023-03-13 09:20:10
 * @LastEditors:  
 */
import { fileURLToPath, URL } from "node:url";

import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
      "@utils": fileURLToPath(new URL("./src/utils", import.meta.url)),
      "@api": fileURLToPath(new URL("./src/api/request", import.meta.url)),
      "@imgs": fileURLToPath(new URL("./src/assets/images", import.meta.url)),
    },
  },
  publicDir: false,
  base: "/blogServe/",
  server: {
    port: 7676,
    proxy: {
      "/api": {
        target: "http://127.0.0.1:8520",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
});
